package com.offcn.service.impl;


import com.offcn.mapper.LoginUserMapper;
import com.offcn.pojo.LoginUser;
import com.offcn.pojo.LoginUserExample;
import com.offcn.pojo.vo.LoginUserVo;
import com.offcn.service.LoginUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginUserServiceImpl implements LoginUserService {
    @Autowired
    LoginUserMapper loginUserMapper;

    @Override
    public boolean loginUserByLoginUserVo(LoginUserVo loginUserVo) {


        LoginUserExample exp = new LoginUserExample();
        LoginUserExample.Criteria criteria = exp.createCriteria();
        criteria.andLoginnameEqualTo(loginUserVo.getUserName());
        criteria.andPasswordEqualTo(loginUserVo.getPassword());
        List<LoginUser> loginUsers = loginUserMapper.selectByExample(exp);
        return loginUsers.size()> 0;
    }

    /* @Autowired
     LoginUserMapper loginUserMapper;
     @Override
     public boolean selectLoginUserByLoginUserVo(LoginUserVo loginUserVo) {

          LoginUserExample exp = new LoginUserExample();
          LoginUserExample.Criteria criteria = exp.createCriteria();
          criteria.andLoginnameEqualTo(loginUserVo.getUserName());
          criteria.andPasswordEqualTo(loginUserVo.getPassword());
          List<LoginUser> loginUsers=loginUserMapper.selectByExample(exp);
          return loginUsers.size()>0;
     }*/
}
